package com.zbkj.admin.controller.platform.shop;

import com.zbkj.common.model.shop.EbShopTypeCommission;
import com.zbkj.common.result.CommonResult;
import com.zbkj.service.service.shop.EbShopTypeCommissionService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/api/admin/platform/shopTypeCommission")
@Api(tags = "店铺分佣设置")
public class PlatformShopTypeCommissionController {
    @Autowired
    EbShopTypeCommissionService ebShopTypeCommissionService;

    /**
     * 添加
     *
     * @param ebShopTypeCommissionList
     * @return
     */
    @PostMapping(value = "/add")
    public CommonResult<Integer> add(@RequestBody List<EbShopTypeCommission> ebShopTypeCommissionList) {
        return CommonResult.success(ebShopTypeCommissionService.add(ebShopTypeCommissionList));

    }


    /**
     * 修改
     *
     * @param ebShopTypeCommissionList
     * @return
     */
    @PostMapping(value = "/update")
    public CommonResult<Integer> update(@RequestBody List<EbShopTypeCommission> ebShopTypeCommissionList) {
        return CommonResult.success(ebShopTypeCommissionService.update(ebShopTypeCommissionList));
    }



    /**
     * 根据店铺类型查询分佣信息
     *
     * @param shopTypeId
     * @return
     */
    @PostMapping(value = "/findByShopTypeId/{shopTypeId}")
    public CommonResult<List<EbShopTypeCommission>> findByShopTypeId(@PathVariable("shopTypeId") Integer shopTypeId) {
        return CommonResult.success(ebShopTypeCommissionService.findByShopTypeId(shopTypeId));
    }

}
